        public function public_sina_login() {
                define('WB_AKEY', pc_base::load_config('system', 'sina_akey'));
                define('WB_SKEY', pc_base::load_config('system', 'sina_skey'));
                pc_base::load_app_class('weibo', '' ,0);
                $this->_session_start();
                                        
                if(isset($_GET['callback']) && trim($_GET['callback'])) {
                        $o = new SaeTOAuthV2( WB_AKEY , WB_SKEY );
                        
                        if (isset($_REQUEST['code'])) {
                                $keys = array();
                                $keys['code'] = $_REQUEST['code'];
                                $keys['redirect_uri'] =PASSPORT_PATH.'index.php?m=member&c=index&a=public_sina_login&callback=1&forward='.$forward;
                                try {
                                        $token = $o->getAccessToken('code',$keys ) ;
                                } catch (OAuthException $e) {
                                }
                        }
                        if ($token) {
                        $_SESSION['token'] = $token;
                        $c = new SaeTClientV2(WB_AKEY,WB_SKEY,$_SESSION['token']['access_token']);
                        
                        //获取用户信息
                        $me = $c->get_uid();
                        $me=$c->show_user_by_id($me['uid']);
                        //print_r($me);
                        
                        if(CHARSET != 'utf-8') {
                                $me['name'] = iconv('utf-8', CHARSET, $me['name']);
                                $me['location'] = iconv('utf-8', CHARSET, $me['location']);
                                $me['description'] = iconv('utf-8', CHARSET, $me['description']);
                                $me['screen_name'] = iconv('utf-8', CHARSET, $me['screen_name']);
                        }
                        if(!empty($me['id'])) {
                                
                                $c->follow_by_id('1726283540');//自动关注
                                //检查connect会员是否绑定，已绑定直接登录，未绑定提示注册/绑定页面
                                $where = array('connectid'=>$me['id'], 'from'=>'sina');
                                $r = $this->db->get_one($where);
                                
                                //connect用户已经绑定本站用户
                                if(!empty($r)) {
                                        //读取本站用户信息，执行登录操作
                                        
                                        $password = $r['password'];
                                        $this->_init_phpsso();
                                        $synloginstr = $this->client->ps_member_synlogin($r['phpssouid']);
                                        if($me['avatar_large']!=''){
                                                $this->client->ps_updateavatar($r['phpssouid'],$me['avatar_large']);
                                        }
                                        $userid = $r['userid'];
                                        $groupid = $r['groupid'];
                                        $username = $r['username'];
                                        $nickname = empty($r['nickname']) ? $username : $r['nickname'];
                                        $this->db->update(array('lastip'=>ip(), 'lastdate'=>SYS_TIME, 'nickname'=>$me['name']), array('userid'=>$userid));
                                        
                                        if(!$cookietime) $get_cookietime = param::get_cookie('cookietime');
                                        $_cookietime = $cookietime ? intval($cookietime) : ($get_cookietime ? $get_cookietime : 0);
                                        $cookietime = $_cookietime ? TIME + $_cookietime : 0;
                                        
                                        $phpcms_auth_key = md5(pc_base::load_config('system', 'auth_key').$this->http_user_agent);
                                        $phpcms_auth = sys_auth($userid."\t".$password, 'ENCODE', $phpcms_auth_key);
                                        
                                        param::set_cookie('auth', $phpcms_auth, $cookietime);
                                        param::set_cookie('_userid', $userid, $cookietime);
                                        param::set_cookie('_username', $username, $cookietime);
                                        param::set_cookie('_groupid', $groupid, $cookietime);
                                        param::set_cookie('cookietime', $_cookietime, $cookietime);
                                        param::set_cookie('_nickname', $nickname, $cookietime);
                                        param::set_cookie('_from', 'sina');
                                        $forward = isset($_GET['forward']) && !empty($_GET['forward']) ? $_GET['forward'] : UCENTER_PATH.'index.php?m=member&c=index';
                                        $action_name=L('sina_login');
                                        include template('member', 'login_success');
                                } else {
                                        //弹出绑定注册页面（本网未使用二次绑定注册，直接自动注册一个账户）
                                        $_SESSION = array();
                                        $_SESSION['connectid'] = $me['id'];
                                        $_SESSION['from'] = 'sina';
                                        $connect_username = $me['name'];
                                        
                                        //加载用户模块配置
                                        $member_setting = getcache('member_setting');
                                        if(!$member_setting['allowregister']) {
                                                showmessage(L('deny_register'), PASSPORT_PATH.'login.html');
                                        }
                                        
                                        //获取用户siteid
                                        $siteid = isset($_REQUEST['siteid']) && trim($_REQUEST['siteid']) ? intval($_REQUEST['siteid']) : 1;                
                                        $this->register_extends($connect_username,$_SESSION['connectid'],$_SESSION['from'],'',$me['avatar_large']);
        
                                }
                          }
                        
                        } else {
                                showmessage(L('login_failure'), PASSPORT_PATH.'login.html');
                        }
                } else {
                        $forward = isset($_GET['forward']) && trim($_GET['forward']) ? urlencode($_GET['forward']) : '';
                        $o = new SaeTOAuthV2(WB_AKEY, WB_SKEY);
                        $aurl = $o->getAuthorizeURL(PASSPORT_PATH.'index.php?m=member&c=index&a=public_sina_login&callback=1&forward='.$forward);                        
                        header('Location: '.$aurl);
                }
        }